package jdk;

/**
 * @Author: Yangu
 * @Created time: 2021/1/7 10:48
 * @Description :
 */
public class Person {

    private String sex;

    private Integer color;

    private Person() {
        System.out.println("我是人");
    }

    public Person(String sex) {
        this.sex = sex;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Person person = (Person) o;

        if (sex != null ? !sex.equals(person.sex) : person.sex != null) return false;
        return color != null ? color.equals(person.color) : person.color == null;
    }

    @Override
    public int hashCode() {
        int result = sex != null ? sex.hashCode() : 0;
        result = 31 * result + (color != null ? color.hashCode() : 0);
        return result;
    }
}
